import time, urllib.request
import requests

def check_staus(url):

    try:
        response = urllib.request.urlopen(url, timeout=5)
        if str(response.getcode()).startswith("2"):
            return True
    except Exception as e:
        print('appium 端口 启动失败')
        return False


response = check_staus('http://127.0.0.1:4723/wd/hub/status')
print(response)

# res = requests.request('get',url='http://127.0.0.1:4723/wd/hub/status')
# print(res.status_code)